package com.zlx.store.domain.entity.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zlx.store.domain.entity.Goods;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("goods_tab")
public class GoodsVO {
    /**
     * 商品id
     */
    @TableId(value = "goods_id",type = IdType.AUTO)
    private Long goodsId;
    /**
     * 商品名字
     */
    @TableField("goods_name")
    private String goodsName;
    /**
     * 商品种类id
     */
    @TableField("goods_category")
    private Long goodsCategory;
    /**
     * 商品编号/spu
     */
    @TableField("goods_spu")
    private String goodsSPU;
    /**
     * 商品图片的地址
     */
    @TableField("goods_pic")
    private String goodsPic;
    /**
     * 商品价格
     */
    @TableField("goods_price")
    private Double goodsPrice;
    /**
     * 商品所属门店id
     */
    @TableField("goods_store_id")
    private Long goodsStoreId;

    /**
     * 商品单品库存
     */
    private Long goodSales;

    /**
     * 购买数量
     */
    private Integer goodsCount;
    /**
     *
     * @param goods
     * @return
     */
    public GoodsVO build(Goods goods){
        this.goodsId= goods.getGoodsId();
        this.goodsName=goods.getGoodsName();
        this.goodsPic=goods.getGoodsPic();
        this.goodsSPU=goods.getGoodsSPU();
        this.goodsCategory= goods.getGoodsCategory();
        return this;}
}
